<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/jQuery1.4.1.js"></script>

</head>

<body>
    <script src="https://cdn.bootcss.com/FileSaver.js/2014-11-29/FileSaver.js"></script>
    <input type="button" id="export" value="保存" />

    <script>
        var button = document.getElementById("export");
        button.addEventListener("click", saveHandler, false);
        function saveHandler() {
            let data = {
                name: "hanmeimei",
                age: 88
            }
            var content = JSON.stringify(data);
            var blob = new Blob([content], { type: "text/plain;charset=utf-8" });
            saveAs(blob, "save.json");
        }
    </script>

</body>

</html>